<!--$Id: open.so,v 10.18 2003/10/18 19:15:53 bostic Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB Reference Guide: Database open</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<a name="2"><!--meow--></a>
<table width="100%"><tr valign=top>
<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></b></td>
<td align=right><a href="../am/ops.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am/opensub.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p align=center><b>Database open</b></p>
<p>The <a href="../../api_c/db_open.html">DB-&gt;open</a> method opens a database, and takes five arguments:</p>
<br>
<b>file</b><ul compact><li>The name of the file to be opened.</ul>
<b>database</b><ul compact><li>An optional database name.</ul>
<b>type</b><ul compact><li>The type of database to open.  This value will be one of the four access
methods Berkeley DB supports: DB_BTREE, DB_HASH, DB_QUEUE or DB_RECNO, or the
special value DB_UNKNOWN, which allows you to open an existing file
without knowing its type.</ul>
<b>mode</b><ul compact><li>The permissions to give to any created file.</ul>
<br>
<p>There are a few flags that you can set to customize open:</p>
<br>
<b><a href="../../api_c/env_open.html#DB_CREATE">DB_CREATE</a></b><ul compact><li>Create the underlying database and any necessary physical files.</ul>
<b><a href="../../api_c/env_set_flags.html#DB_NOMMAP">DB_NOMMAP</a></b><ul compact><li>Do not map this database into process memory.</ul>
<b><a href="../../api_c/db_open.html#DB_RDONLY">DB_RDONLY</a></b><ul compact><li>Treat the data base as read-only.</ul>
<b><a href="../../api_c/env_open.html#DB_THREAD">DB_THREAD</a></b><ul compact><li>The returned handle is free-threaded, that is, it can be used
simultaneously by multiple threads within the process.</ul>
<b><a href="../../api_c/db_open.html#DB_TRUNCATE">DB_TRUNCATE</a></b><ul compact><li>Physically truncate the underlying database file, discarding all
databases it contained. Underlying filesystem primitives are used to
implement this flag. For this reason it is only applicable to the
physical file and cannot be used to discard individual databases from
within physical files.</ul>
<b><a href="../../api_c/db_set_feedback.html#DB_UPGRADE">DB_UPGRADE</a></b><ul compact><li>Upgrade the database format as necessary.</ul>
<br>
<table width="100%"><tr><td><br></td><td align=right><a href="../am/ops.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../am/opensub.html"><img src="../../images/next.gif" alt="Next"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>
